package com.example.ytyproject.controller;


import com.baomidou.mybatisplus.extension.api.R;
import com.example.ytyproject.entity.Logs;
import com.example.ytyproject.service.ICensuspaperService;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import javax.servlet.http.HttpServletRequest;
import java.time.LocalDateTime;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author yg
 * @since 2023-11-20
 */
@RestController
@RequestMapping("/censuspaper")
public class CensuspaperController {

    @Autowired
    private ICensuspaperService iCensuspaperService;

    @PostMapping("impportData")
    @ApiOperation(value = "impportData",notes = "impportData")
    public R importRepayReconciliate(MultipartFile file, HttpServletRequest request){
        try {
            // 判断文件是否为空
            if (!file.isEmpty()) {
                // 文件保存路径
                iCensuspaperService.importRepayReconciliate(file.getInputStream(),request);
                return R.ok(null);
            }
            return R.ok(null);
        } catch (Exception e) {
            e.printStackTrace();
            return R.failed("数据不规范，请检查数据:" + e.getMessage());
        }
    }

}
